<template>
	<view class="content">
		<view style="display: flex;flex-direction: column;width: 100%;background: white;" v-if="list.length > 0">
			<view v-for="(item,k) in list" style="width: 100%;display: flex;justify-content: space-between;padding: 20rpx;border-bottom: 1rpx solid #f8f8f8;">
				<view style="display: flex;align-items: center;">
					<u-avatar :src="$store.state.common.systemInfo.fileurl + 'avatar/' + item.toid + '.jpg'"></u-avatar>
					<view style="display: flex;flex-direction: column;margin-left: 15rpx;">
						<view style="">
							{{item.toname?item.toname:item.gname}}
						</view>
						<view style="font-size: 25rpx;color: #b3b3b3;margin-top: 6rpx;">
							{{$u.timeFormat(item.time, 'mm-dd hh:MM:ss')}}
						</view>
					</view>
				</view>
				<view class="">
					<text v-if="item.type == 'out'">-{{item.money}}</text>
					<text v-else style="color: #ffaa00;">+{{item.money}}</text>
				</view>
			</view>
		</view>
		<view style="width: 100%;display: flex;justify-content: center;margin-top: 180rpx;" v-else>
			<u-empty></u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
			}
		},
		onLoad() {
			this.getdata()
		},
		methods: {
			getdata: async function() {
				const user = this.$store.state.user.user
				const ret = await this.$u.post(`bgyx/bgyx/getdata/moneylog`,{
					where:{
						uid:user.id
					},
					order:{
						time:"desc"
					}
				})
				if(ret && ret.success){
					this.list = ret.data
				}
			},
		}
	}
</script>

<style scoped>
	.content {
		width: 100%;
		height: 100vh;
		display: flex;
		flex-direction: column;
		background: #FFF;
		padding: 25rpx;
		overflow-y: auto;
	}
</style>